<template>
  <div id="right-sidebar" v-loading.lock="loading">
    <div class="header">当前播放</div>
    <div class="info">
      <div class="count">总{{ playlistTableData.length }}首</div>
      <div class="right-box">
        <div class="collection-all">
          <i class="iconfont icon-collection1"></i>收藏全部
        </div>
        <div class="clear-all">清空列表</div>
      </div>
    </div>
    <div class="playlist">
      <template>
        <el-table
          @row-dblclick="clickMusic"
          size="small"
          :data="playlistTableData"
          stripe
          style="width: 100%"
        >
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="title" label="标题"></el-table-column>
          <el-table-column prop="artist" label="歌手"> </el-table-column>
          <el-table-column prop="album" label="专辑"> </el-table-column>
        </el-table>
      </template>
    </div>
  </div>
</template>

<script>
import { mapGetters, mapState } from "vuex";
export default {
  computed: {
    ...mapState({
      detail: (state) => state.playlistDetail.playlistDetail,
      controller: (store) => store.controller.controller,
      loading: (state) => state.playlistDetail.loading,
    }),
    ...mapGetters(["playlistTableData"]),
  },
  methods: {
    // 双击播放音乐
    clickMusic(row) {
      let id = row.id;
      this.$store.dispatch("appendAll", {
        list: this.detail.musicList.songs,
        id,
      });
    },

  },
};
</script>

<style lang='less'>
#right-sidebar {
  position: fixed;
  top: 58px;
  right: 0;
  bottom: 80px;
  width: 400px;
  background: #fff;
  z-index: 800;
  padding: 0 20px;
  box-shadow: -15px 0 15px -21px #000;
  overflow: scroll;
  .header {
    margin-top: 20px;
    font-size: 20px;
    font-weight: bold;
  }
  .info {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    .count {
      color: #999;
    }
    .right-box {
      display: flex;
      .collection-all {
        color: #999;
        i {
          margin-right: 5px;
        }
        margin-right: 20px;
      }
      .clear-all {
        color: var(--themeColor1);
      }
    }
  }
}
</style>